PostgreSQL 安全管理 网络传输安全
1 加入 --with-openssl参数
用 SSL 进行安全的 TCP/IP 连接,对网络传输的数据进行加密,保证网络传输中数据的安全。
PG有一个对使用 SSL 连接加密客户端/服务器通讯的本地支持,它可以增加安全性。这个特性要求在客户端和服务器端都安装 OpenSSL 并且在编译的时候打开这个支持。
编译配置时增加--with-openssl参数,让postgresql支持ssl认证方式,即
./configure ... --with-openssl
安装后的检查方法:pg_config
2 未加 --with-openssl参数
如果编译时没有加上 --with-openssl参数,配置ssl功能后会报类似下面的错误:
[postgres@localhost data]$ pg_ctl restart -m fast -w
waiting for server to shut down.... done
server stopped
waiting for server to start....2020-08-24 09:46:02.806 GMT [19547] LOG: SSL is not supported by this build
2020-08-24 17:46:02.993 CST [19547] FATAL: configuration file "/opt/pg12/data/postgresql.conf" contains errors
stopped waiting
pg_ctl: could not start server
Examine the log output.
3 证书分类
3.1 自签名私有证书
自证身份不可信,只有加密功能,用于无需身份证明的场合。
3.2 自签名CA证书
1、CA签名的证书兼具“身份证明”和“加密”双重功能。
2、支持吊销列表。
3.3 权威机构的CA证书
1、使用机构签发的证书时候需要联网签发。
2、需要收费。